#include "SDL/SDL.h"
#include <map>
#include <string>
#include <utility>
#include "keys.h"

using namespace std;
Keys::Keys()
{
	m_keymap["return"]= SDLK_RETURN;
	m_keymap["pause"]= SDLK_PAUSE;
	m_keymap["escape"]= SDLK_ESCAPE;
	m_keymap["space"]= SDLK_SPACE;
}

void Keys::addKey(string key, SDLKey value)
{
	m_keymap.insert( pair<string, SDLKey>(key, value) );
}

bool Keys::isDown(std::string key, SDL_Event& event)
{ 
	return ( (event.type  == SDL_KEYDOWN ) && (event.key.keysym.sym == m_keymap[key]) );
}
